package com.mohe.dangjian.utils;

/**
 * 分页实体类
 * 
 * @author zh
 * 
 */
public class Page {

	// 总页数
	private Integer pageCount = 0;

	// 页大小
	private Integer pageSize = 10;

	// 当前页
	private Integer currPage = 1;

	// 总记录条数
	private Integer count = 0;

	// 当前页查询出的记录数
	private Integer currentCount = 0;

	public Integer getCurrentCount() {
		return currentCount;
	}

	public void setCurrentCount(Integer currentCount) {
		this.currentCount = currentCount;
	}

	public Integer getPageCount() {
		return pageCount;
	}

	public void setPageCount(Integer pageCount) {
		this.pageCount = pageCount;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getCurrPage() {
		return currPage;
	}

	public void setCurrPage(Integer currPage) {
		this.currPage = currPage;
	}

	public Integer getCount() {
		return count;
	}
	private Integer num1;
	private Integer num2;
	private Integer num3;
	private Integer num4;
	private Integer num5;
	public Integer getNum1() {
		return num1;
	}

	public void setNum1(Integer num1) {
		this.num1 = num1;
	}

	public Integer getNum2() {
		return num2;
	}

	public void setNum2(Integer num2) {
		this.num2 = num2;
	}

	public Integer getNum3() {
		return num3;
	}

	public void setNum3(Integer num3) {
		this.num3 = num3;
	}

	public Integer getNum4() {
		return num4;
	}

	public void setNum4(Integer num4) {
		this.num4 = num4;
	}

	public Integer getNum5() {
		return num5;
	}

	public void setNum5(Integer num5) {
		this.num5 = num5;
	}

	public void setCount(Integer count) {
		if (count % pageSize == 0) {
			pageCount = count / pageSize;
			currentCount = pageSize;
		} else {
			pageCount = count / pageSize + 1;
			currentCount = count % pageSize;
		}
		this.count = count;
	}
	/**
	 * 每页的起始位置
	 * 
	 * @return
	 */
	public Integer startPage() {
		if (currPage == null) {
			currPage = 1;
		}
		if (currentCount == 0 && currPage > 1) {
			return (currPage - 2) * pageSize;
		} else if (pageCount != 0 && currPage > pageCount) {
			currPage = currPage - 1;
			return (pageCount - 1) * pageSize;
		} else {
			return (currPage - 1) * pageSize;
		}
	}

}
